package com.devunion.salon.persistence;

import javax.persistence.*;
import java.util.List;

/**
 CREATE TABLE `login` (
   `id` int(11) NOT NULL auto_increment,
   `fname` varchar(50) default NULL,
   `lname` varchar(50) NOT NULL,
   `user` varchar(50) NOT NULL,
   `pwd` varchar(50) NOT NULL,
   `email` varchar(255) default NULL,
   `permission` int(11) NOT NULL default '0',
   PRIMARY KEY  (`id`),
   UNIQUE KEY `user` (`user`)
 ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
 *
 * @author Viktar Liaskovich
 */

@Entity
@Table(name = "login")
public class Login extends BasePersistentObject{
    
    @Column(name = "login", length = 50, nullable = false)
    private String login;

    @Column(name = "password", length = 50, nullable = false)
    private String password;

    @Column(name = "role", length = 50, nullable = true)
    private String role;

    @ManyToOne(cascade = {CascadeType.ALL})
    private Location location;       
    
    public String getLogin() {
        return login;
    }

    public void setLogin(String login) {
        this.login = login;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getRole() {
        return role;
    }

    public void setRole(String role) {
        this.role = role;
    }

    public Location getLocation() {
        return location;
    }

    public void setLocation(Location location) {
        this.location = location;
    }
}
